package com.wrl.mmall.common.enums;

import lombok.Getter;

/**
 * 支付方式
 *
 * @author Wang Renlei
 * @Date 2020/5/7 0007
 */
@Getter
public enum PaymentTypeEnum {
    ONLINE_PAY(1, "在线支付");

    private int code;
    private String value;

    PaymentTypeEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    //静态方法。传过来code，返回汉字
    public static PaymentTypeEnum codeOf(int code) {
        for (PaymentTypeEnum pte : values()) {
            if (code == pte.getCode()) {
                return pte;
            }
        }
        throw new RuntimeException("没有找到对应的枚举");
    }


}
